package com.cjw.demo.controller;


import com.cjw.demo.entity.MTenant;
import com.cjw.demo.service.IMTenantService;
import com.cjw.demo.vo.Voo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author cjw
 * @since 2021-11-18
 */
@RestController
@RequestMapping("/tenant")
@CrossOrigin
public class MTenantController {
    @Autowired
    IMTenantService iMTenantService;


    @RequestMapping("listhouse")
    @XxlJob("house")
    public PageInfo<MTenant> listreq(@RequestParam(defaultValue = "1")Integer pageNum, @RequestParam(defaultValue = "10")Integer pageSize, Voo vo){
        System.err.println("定时任务开启开始执行");
        PageHelper.startPage(pageNum,pageSize);

        List<MTenant> list = iMTenantService.lists(vo);

        PageInfo<MTenant> info = new PageInfo<>(list);

        return info;
    }
}
